<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>注册</title>
	<link rel="stylesheet" href="../../assets/css/relys/login.css">
</head>
<body>
<div class="wrapper" id="app">
	<div class="form-box login" id="userregister">
		<h2>用户注册</h2>
		<form action="#">
			<div class="input-box">
				<span class="icon"><ion-icon name="person-circle"></ion-icon></span>
				<input v-model="username" type="text" required>
				<label>账号</label>
			</div>
			<div class="input-box">
				<span class="icon"><ion-icon name="lock-closed"></ion-icon></span>
				<input v-model="mima" type="password" required>
				<label>密码</label>
			</div>
			<div class="input-box">
				<span  class="icon"><ion-icon name="person"></ion-icon></span>
				<input v-model="xingming" type="text" required>
				<label>姓名</label>
			</div>
			<div class="input-box">
				<span class="icon"><ion-icon name="call"></ion-icon></span>
				<input v-model="dianhua" type="text" required>
				<label>联系方式</label>
			</div>
			<div class="input-box">
				<span class="icon"><ion-icon name="mail"></ion-icon></span>
				<input v-model="youxiang" type="email" required>
				<label>邮箱</label>
			</div>
			<button type="submit" class="btn" @click="userRegister">注册</button>
			<div class ="login-register"><p>已有账号?
				<a href="../login/login.html" class="userlogin-link">登录</a></p></div>
		</form>
	</div>
</div>
<script src="../../assets/js/relys/jquery.js"></script>
<script src="../../assets/js/relys/vue.js"></script>
<script src="../../assets/js/api/api.js"></script>
<script src="../../assets/js/api/defaultuser.js"></script>
<script type="text/javascript">
			var app = new Vue({
				el: "#app",
				data: {
					username: '',
					mima: '',
					"xingming": "",
					"dianhua": "",
					"youxiang": "",
				},
				methods: {
					userRegister(){
						var data = {
							"yonghuming": this.username,
							"mima": this.mima,
							"xingming": this.xingming,
							"dianhua": this.dianhua,
							"youxiang": this.youxiang,
						}
						register('yonghu', data, function(res){
							if(res.code==0){
								alert('注册成功')
								window.parent.location.href = '../login/login.html'
							}
						})
					}
				}
			})
		</script>
</body>
</html>
